package com.aaa.ssm.controller;

import com.aaa.ssm.entity.Artchannel;
import com.aaa.ssm.service.ArtchannelService;
import com.aaa.ssm.util.Page;
import com.aaa.ssm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("DicArtchannel")
public class ArtchannelController extends BaseController{

    //依赖注入
    @Resource
    private ArtchannelService dicArtchannelService;

    @PostMapping("queryPage")
    public Result queryPage(@RequestBody Page<Artchannel> page) {
        return success(dicArtchannelService.queryPage(page));
    }

    @PostMapping("add")
    public Result add(@RequestBody Artchannel dicArtchannel ) {
        return success(dicArtchannelService.add(dicArtchannel));
    }

    @PostMapping("update")
    public Result update(@RequestBody Artchannel dicArtchannel) {
        return success(dicArtchannelService.update(dicArtchannel));
    }

    @DeleteMapping("delete/{code}")
    public Result delete(@PathVariable("code") String code) {
        return success(dicArtchannelService.delete(code));
    }
}
